import { http } from '@/utils/http'

export function usePmBpmApi() {
  return {
    getBpmTodoPage(query: Record<string, any>) {
      return http.get('/prod-api/admin-api/bpm/task/todo-page', query)
    },
    getProcessInstance(id: string) {
      return http.get('/prod-api/admin-api/bpm/process-instance/get?id=' + id)
    },
    getBpmTaskListByPiId(processInstanceId: string) {
      return http.get<PmBpmTask[]>('/prod-api/admin-api/bpm/task/list-by-process-instance-id?processInstanceId=' + processInstanceId)
    },
    approveTask(data?: Record<string, any>) {
      return http.put('/prod-api/admin-api/bpm/task/approve', data)
    },
    rejectTask(data?: Record<string, any>) {
      return http.put('/prod-api/admin-api/bpm/task/reject', data)
    },
    updateTaskAssignee(data: {
      id: string,
      assigneeUserId: string,
    }) {
      return http.put('/prod-api/admin-api/bpm/task/update-assignee', data)
    }
  }
}
